<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta content="App Inventor for Android" name="description">
    <meta content="Android, Blocks App Inventor, Mobile, Phone, IDE" name="keywords">
    <title>
      Math Blocks - App Inventor for Android
    </title>
    <link href="../../../static/images/appinventor-16.png" rel="SHORTCUT ICON" type="image/ico">
    <link href="../../../static/images/appinventor-16.png" rel="icon" type="image/png">
    <link href="../../../static/css/appinventor.css" rel="stylesheet" type="text/css">
<!-- ADD Google Analytics here -->
<!-- END Google Analytics here -->
    <style type="text/css">
img.c2 {border-width:0}
    div.c1 {clear:both;}
    </style>
  </head>
  <body>
    <div id="aiac">
      <div class="main-container">
        <div class="header">
          <div class="header-title">
            <a href="../../../about/index.html"><img alt="" src="../../../static/images/appinventor_logo.gif"></a>
          </div>
            <div class="header-search">
<!-- ADD Google Custom Search -->
<!-- END Google Custom Search -->
              <div class="header-search-query">
              </div>
              <div class="header-search-button">
              </div>
            </div>
          <div class="header-login">
            <div class="header-login-greeting">
              Learn about App Inventor
            </div>
          </div>
        </div>
        <div class="customhr customhr-green"></div>
<!-- ADD Google Search Results -->
<!-- END Google Search Results -->
        <div id="navigation">
          <div id="navigation-links">
            <div class="navigation-link-option" id="navigation-link-home">
              <a href="../../../about/index.html">About</a>
            </div>
            <div class="navigation-link-option navigation-link-active" id="navigation-link-learn">
              <a href="../../../learn/index.html">Learn</a>
            </div>
            <div class="navigation-link-option" id="navigation-link-forum">
              <a href="../../../forum/index.html">Forum</a>
            </div>
            <div class="navigation-link-option" id="navigation-link-myappinventor">
              <a href="">My Projects</a><div>(coming soon)</div>
            </div>
          </div>
          <div id="navigation-breadcrumb">
            <a href="../../../learn/index.html">Learn</a> &gt; <a href="../../../learn/reference/index.html">Reference</a> &gt; Math Blocks &gt;
          </div>
          <div class="c1"></div>
        </div>
        <div class="customhr customhr-gray"></div>
        <div class="content">
          <div class="content-body">
            <div class="learn-page">
              <h1>
                Math Blocks
              </h1>
              <ul>
                <li>
                  <a href="#number">number</a>
                </li>
                <li>
                  <a href="#greaterthan">&gt;</a>
                </li>
                <li>
                  <a href="#lessthan">&lt;</a>
                </li>
                <li>
                  <a href="#lessequal">&lt;=</a>
                </li>
                <li>
                  <a href="#greaterequal">&gt;=</a>
                </li>
                <li>
                  <a href="#equals">equals</a>
                </li>
                <li>
                  <a href="#plus">+</a>
                </li>
                <li>
                  <a href="#minus">−</a>
                </li>
                <li>
                  <a href="#times">×</a>
                </li>
                <li>
                  <a href="#divide">/</a>
                </li>
                <li>
                  <a href="#sqrt">sqrt</a>
                </li>
                <li>
                  <a href="#randomfraction">random fraction</a>
                </li>
                <li>
                  <a href="#randominteger">random integer</a>
                </li>
                <li>
                  <a href="#randomsetseed">random set seed</a>
                </li>
                <li>
                  <a href="#negate">negate</a>
                </li>
                <li>
                  <a href="#min">min</a>
                </li>
                <li>
                  <a href="#max">max</a>
                </li>
                <li>
                  <a href="#quotient">quotient</a>
                </li>
                <li>
                  <a href="#remainder">remainder</a>
                </li>
                <li>
                  <a href="#modulo">modulo</a>
                </li>
                <li>
                  <a href="#abs">abs</a>
                </li>
                <li>
                  <a href="#round">round</a>
                </li>
                <li>
                  <a href="#floor">floor</a>
                </li>
                <li>
                  <a href="#ceiling">ceiling</a>
                </li>
                <li>
                  <a href="#expt">expt</a>
                </li>
                <li>
                  <a href="#exp">exp</a>
                </li>
                <li>
                  <a href="#log">log</a>
                </li>
                <li>
                  <a href="#sin">sin</a>
                </li>
                <li>
                  <a href="#cos">cos</a>
                </li>
                <li>
                  <a href="#tan">tan</a>
                </li>
                <li>
                  <a href="#asin">asin</a>
                </li>
                <li>
                  <a href="#acos">acos</a>
                </li>
                <li>
                  <a href="#atan">atan</a>
                </li>
                <li>
                  <a href="#atan2">atan2</a>
                </li>
                <li>
                  <a href="#formatasdecimal">format as decimal</a>
                </li>
                <li>
                  <a href="#isanumber">is a number?</a>
                </li>
              </ul>
              <h2 id="number">
                number
              </h2><img alt="" src="images/number.png">
              <p>
                Specifies a numeric value.
              </p>
              <h2 id="greaterthan">
                &gt;
              </h2><img alt="" src="images/greaterthan.png">
              <p>
                Compares two given numbers. If the first is larger, returns true; otherwise, returns false.
              </p>
              <h2 id="lessthan">
                &lt;
              </h2><img alt="" src="images/lessthan.png">
              <p>
                Compares two given numbers. If the first is smaller, returns true; otherwise, returns false.
              </p>
              <h2 id="lessequal">
                ≤
              </h2><img alt="" src="images/lessequal.png">
              <p>
                Compares two given numbers. If the first is smaller than or equal to the second, returns true; otherwise, returns false.
              </p>
              <h2 id="greaterequal">
                ≥
              </h2><img alt="" src="images/greaterequal.png">
              <p>
                Compares two given numbers. If the first is greater than or equal to the second, returns true; otherwise, returns false.
              </p>
              <h2 id="equals">
                equals
              </h2><img alt="" src="images/equals.png">
              <p>
                Tests whether two given values are equal. If so, returns true; otherwise, returns false. This is the same as the block in the logic drawer and is repeated here for convenience. The arguments can be anything, not just numbers.
              </p>
              <h2 id="plus">
                +
              </h2><img alt="" src="images/plus.png">
              <p>
                Returns the sum of two given numbers.
              </p>
              <h2 id="minus">
                −
              </h2><img alt="" src="images/minus.png">
              <p>
                Returns the result of subtracting the second number from the first.
              </p>
              <h2 id="times">
                ×
              </h2><img alt="" src="images/times.png">
              <p>
                Returns the product of two given numbers.
              </p>
              <h2 id="divide">
                /
              </h2><img alt="" src="images/divide.png">
              <p>
                Returns the result of dividing the first number by the second. For example, 1 divided by 3 is 0.3333.
              </p>
              <h2 id="sqrt">
                sqrt
              </h2><img alt="" src="images/sqrt.png">
              <p>
                Returns the square root of the given number.
              </p>
              <h2 id="randomfraction">
                random fraction
              </h2><img alt="" src="images/randomfraction.png">
              <p>
                Returns a random value between 0 and 1.
              </p>
              <h2 id="randominteger">
                random integer
              </h2><img alt="" src="images/randominteger.png">
              <p>
                Returns a random integer value between the given values, inclusive. The order of the arguments doesn't matter.
              </p>
              <h2 id="randomsetseed">
                random set seed
              </h2><img alt="" src="images/randomsetseed.png">
              <p>
                Use this block to generate repeatable sequences of random numbers. You can generate the same sequence of random numbers by first calling <code>random set seed</code> with the same value. This is useful for testing programs that involve random values.
              </p>
              <h2 id="negate">
                negate
              </h2><img alt="" src="images/negate.png">
              <p>
                Returns the negative of the given number.
              </p>
              <h2 id="min">
                min
              </h2><img alt="" src="images/min.png">
              <p>
                Returns the smallest of a given set of numbers.
              </p>
              <h2 id="max">
                max
              </h2><img alt="" src="images/max.png">
              <p>
                Returns the largest of a given set of numbers.
              </p>
              <h2 id="quotient">
                quotient
              </h2><img alt="" src="images/quotient.png">
              <p>
                Returns the result of dividing the first number by the second and discarding any fractional part of the result.
              </p>
              <h2 id="remainder">
                remainder
              </h2><img alt="" src="images/remainder.png">
              <p>
                Remainder(a,b) returns the result of dividing a by b and taking the remainder. For example, remainder(11,5) = 1, remainder(-11, 5) = -1, remainder(11, -5) = 1, and remainder(-11, -5) = -1.
              </p>
              <h2 id="modulo">
                modulo
              </h2><img alt="" src="images/modulo.png">
              <p>
                Modulo(a,b) is the same as remainder(a,b) when a and b are positive. More generally, modulo(a,b) is defined for any a and b so that (floor(a/b)× b) + modulo(a,b) = a. For example, modulo(11, 5) = 1, modulo(-11, 5) = 4, modulo(11, -5) = -4, modulo(-11, -5) = -1. Modulo(a,b) always has the same sign as b, while remainder(a,b) always has the same sign as a.
              </p>
              <h2 id="abs">
                abs
              </h2><img alt="" src="images/abs.png">
              <p>
                Returns the absolute value of the given number.
              </p>
              <h2 id="round">
                round
              </h2><img alt="" src="images/round.png">
              <p>
                Rounds the given number to the nearest integer and returns the result. If the number is midway between two integers, rounds to the even integer.
              </p>
              <h2 id="floor">
                floor
              </h2><img alt="" src="images/floor.png">
              <p>
                Calculates the greatest integer that's less than or equal to the given number.
              </p>
              <h2 id="ceiling">
                ceiling
              </h2><img alt="" src="images/ceiling.png">
              <p>
                Returns the smallest integer that's greater than or equal to the given number.
              </p>
              <h2 id="expt">
                expt
              </h2><img alt="" src="images/expt.png">
              <p>
                Raises the first given number to the power of the second and returns the result.
              </p>
              <h2 id="exp">
                exp
              </h2><img alt="" src="images/exp.png">
              <p>
                Returns <em>e</em> (2.71828...) raised to the power of the given number and returns the result.
              </p>
              <h2 id="log">
                log
              </h2><img alt="" src="images/log.png">
              <p>
                Returns the natural logarithm of the given number.
              </p>
              <h2 id="sin">
                sin
              </h2><img alt="" src="images/sin.png">
              <p>
                Returns the sine of the given number in degrees.
              </p>
              <h2 id="cos">
                cos
              </h2><img alt="" src="images/cos.png">
              <p>
                Returns the cosine of the given number in degrees.
              </p>
              <h2 id="tan">
                tan
              </h2><img alt="" src="images/tan.png">
              <p>
                Returns the tangent of the given number in degrees.
              </p>
              <h2 id="asin">
                asin
              </h2><img alt="" src="images/asin.png">
              <p>
                Returns the arcsine of the given number in degrees.
              </p>
              <h2 id="acos">
                acos
              </h2><img alt="" src="images/acos.png">
              <p>
                Returns the arccosine of the given number in degrees.
              </p>
              <h2 id="atan">
                atan
              </h2><img alt="" src="images/atan.png">
              <p>
                Returns the arctangent of the given number in degrees.
              </p>
              <h2 id="atan2">
                atan2
              </h2><img alt="" src="images/atan2.png">
              <p>
                Returns the arctangent of y/x, given y and x.
              </p>
              <h2 id="formatasdecimal">
                format as decimal
              </h2><img alt="" src="images/formatasdecimal.png">
              <p>
                Format a number as a decimal with a given number of places after the decimal point. The number of places must be a non-negative integer. The result is produced by rounding the number (if there were too many places) or by adding zeros on the right (if there were too few).
              </p>
              <h2 id="isanumber">
                is a number?
              </h2><img alt="" src="images/isanumber.png">
              <p>
                Returns true if the given object is a number, and false otherwise.
              </p>
            </div>
          </div>
        </div>
        <div class="footer">
          <div class="footer-legal">
            <p>
              <a href="http://creativecommons.org/licenses/by/3.0/" rel="license"><img alt="Creative Commons License" class="c2" src="http://i.creativecommons.org/l/by/3.0/88x31.png"></a><br>
              This work is licensed under a <a href="http://creativecommons.org/licenses/by/3.0/" rel="license">Creative Commons Attribution 3.0 Unported License</a> .
            </p>
            <p>
              The original work by Google has been modified<br>
              <!-- The modified work was translated from English to [language]<br> -->
              <a href="../../../about/index.html">About</a> | <a href="../../../about/privacy.html">Privacy</a> | <a href="../../../about/termsofservice.html">Terms</a>
            </p>
          </div>
          <div class="footer-lastupdate">
            <script type="text/javascript">
if (document.lastModified != '') {
                var m = "Page last updated: " + document.lastModified;
                var p = m.length-8;
                document.writeln("<center>");
                document.write(m.substring(p, 0));
                document.writeln("<\/center>");
              }
            </script>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>
